package com.GroupSix.dao;

import com.GroupSix.vo.WrongQuestionVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.GroupSix.entity.WrongQuestionEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface

WrongQuestionDao extends BaseMapper<WrongQuestionEntity> {



    //不带科目查询错误题库  关联题目信息表 获取正确答案 选项 题目内容
    @Select(" SELECT\n" +
            "  w.*,\n" +
            "  q.qsanswer,\n" +
            "  q.qs_a,\n" +
            "  q.qs_b,\n" +
            "  q.qs_c,\n" +
            "  q.qs_d,\n" +
            "  q.qs_e,\n" +
            "  q.qscontent \n" +
            "FROM\n" +
            "  wrongquestion w\n" +
            "  LEFT JOIN questionbank q ON w.question_id = q.id" +
            " where w.is_active =1 and  w.user_id = #{userId} and q.qscourse =#{qscourse} " +
            "")

    List<WrongQuestionVo> getWrongQuestionListWithQuestion(@Param("userId") Integer userId, @Param("qscourse") String qscourse);

    //不带科目查询错误题库  关联题目信息表 获取正确答案 选项 题目内容
    @Select(" SELECT\n" +
            "  w.*,\n" +
            "  q.qsanswer,\n" +
            "  q.qs_a,\n" +
            "  q.qs_b,\n" +
            "  q.qs_c,\n" +
            "  q.qs_d,\n" +
            "  q.qs_e,\n" +
            "  q.qscontent \n" +
            "FROM\n" +
            "  wrongquestion w\n" +
            "  LEFT JOIN questionbank q ON w.question_id = q.id" +
            " where w.is_active =1 and  w.user_id = #{userId}  " +
            "")
    List<WrongQuestionVo> getWrongQuestionListWithQuestionNotQscourese(@Param("userId") Integer userId);
}

